﻿@using XStudio.XCRF.Data.Entities.BasicInfo
@model BasicInfo
@{
    ViewBag.Title = "基本信息编辑";
    Layout = "~/Views/Shared/Master.cshtml";
}

@{Html.Telerik().Window().Name("BasicInfoEditWindow").Title("基本信息编辑")
    .Buttons(buttons => buttons.Clear())
    .Content(
@<text>
@{using (Ajax.BeginForm<BasicInfoController>(c => c.BasicInfoEdit(null),
    new AjaxOptions { OnBegin = "BeforeSend", OnSuccess = "OnSuccess", OnFailure = "OnError" }))
  {
@Html.HiddenFor(model => model.ID)
@Html.HiddenFor(model => model.CRFID)
@:签署知情同意书日期:@Html.DateEditorFor(model => model.AgreeTime)<br />
@:药物编号:@Html.TextBoxFor(model => model.MedicineCode)<br />
@:性别:@Html.GenderEditorFor(model => model.CRF.Patient.Gender)<br />
@:生日:@Html.DateEditorFor(model => model.CRF.Patient.Birthday)<br />
@:身高:@Html.Telerik().NumericTextBoxFor(model => model.Height)<br />
@:体重:@Html.Telerik().NumericTextBoxFor(model => model.Weight)<br />
@:电话:@Html.TextBoxFor(model => model.CRF.Patient.Phone)<br />
@:病例来源:@Html.SourceTypeDisplayFor(model => model.Source)<br />
if (Model.Source == (byte)SourceTypes.InPatient)
{
    @:住院号:@Html.TextBoxFor(model => model.AdmissionCode)<br />
}
@:病程:@Html.Telerik().NumericTextBoxFor(model => model.Course)月<br />
@:相关家族史:<br />
@Html.Partial("FamilyHistoryGridView", Model)
@:过敏史:<br />
@Html.Partial("AllergyHistoryGridView", Model)
@:西药诊断:@Html.TextBoxFor(model => model.WestDiagnose)<br />
@:确诊时间:@Html.DateEditorFor(model => model.DiaTime)<br />
@:病理:<br />
@:病历号：@Html.TextBoxFor(model => model.CaseCode)<br />
@:病理号：@Html.TextBoxFor(model => model.PathologyCode)<br />
@:手术医院：@Html.TextBoxFor(model => model.OperationHospital)<br /> 
@:手术时间：@Html.DateEditorFor(model => model.OperationTime)<br />
@:手术次数及方式：@Html.TextBoxFor(model => model.Oper)<br />
@:肿块大小：<br />
@:长*宽*高:
@Html.TextBoxFor(model => model.TumorLength)
@:*
@Html.TextBoxFor(model => model.TumorWidth)
@:*
@Html.TextBoxFor(model => model.TumorHeight)
@:cm<br />
@:癌肿部位:@Html.TumorPlaceEditorFor(model => model.TumorPlace)
@:<span id="distance" style="visibility:hidden">&nbsp;&nbsp;距离
@Html.TextBoxFor(model=>model.Distance)
@:</span><br />
@:病理学类型:@Html.PathologyTypeEditorFor(model => model.PathologyType)<br />
@:侵润部位:@Html.InfiltrationPlaceEditorFor(model => model.InfiltrationPlace)<br />
@:分化:@Html.SplitEditorFor(model => model.Split)<br />
@:淋巴结转移:@Html.LymphMoveEditorFor(model => model.LymphMove)<br />
@:切缘:标本上切缘:@Html.TopCutEdgeEditorFor(model => model.TopCutEdge)
@:标本下切缘:@Html.BottomCutEdgeEditorFor(model => model.BottomCutEdge)<br />
@:R0（肿瘤完全切除）R1（不完全肿瘤切除，切缘镜下阳性，肉眼根治切除）R2(不完全肿瘤切除，切缘残存肉眼可见肿瘤)<br />
@:腹水：@Html.YouWuEditorFor(model => model.fs)<br />
@:胸水：@Html.YouWuEditorFor(model => model.xs)<br />
@:复发转移情况：@Html.YouWuEditorFor(model => model.ffzyqk)<br />
@:复发转移部位：@Html.TextBoxFor(model => model.ffzybw)<br />
@:发现转移时间：@Html.DateEditorFor(model => model.fxzysj)<br />
@:转移途径：@Html.TextBoxFor(model => model.zytj)<br />
@:死亡否：@Html.YouWuEditorFor(model => model.swf)<br />
@:无进展生存时间：@Html.DateEditorFor(model => model.wjzscsj)<br />
@:死亡原因：@Html.TextBoxFor(model => model.swyy)<br />
@:脑管内癌栓:@Html.PulseEmbolusEditorFor(model => model.PulseEmbolus)<br />
@:KPS评分:@Html.KPSEditorFor(model => model.KPS)<br />
@:ECOG评分:@Html.ECOGEditorFor(model => model.ECOG)<br />
@:TNM分期:@Html.TNMEditorFor(model => model.TNM)<br />
@:Dukes分期:@Html.DukesEditorFor(model => model.Dukes)<br />
@:治疗史:<br />
@:化疗:<br />
@Html.Partial("BasicChemoGridView", Model)
@:放疗:<br />
@Html.Partial("BasicRadioGridView", Model)
@:其他治疗:<br />
@Html.Partial("BasicOtherCureGridView", Model)
@:合并其它疾病及用药:<br />
@Html.Partial("BasicOtherMergeGridView", Model)
@:一般体格检查:<br />
@:体温:@Html.Telerik().NumericTextBoxFor(model => model.Temperature) ℃<br />
@:心率:@Html.Telerik().NumericTextBoxFor(model => model.HeartRate) 次/分<br />
@:呼吸:@Html.Telerik().NumericTextBoxFor(model => model.Breath) 次/分<br />
@:血压:@Html.Telerik().NumericTextBoxFor(model => model.MaxBP)
@:/@Html.Telerik().NumericTextBoxFor(model => model.MinBP) mmHg<br />
<input type="submit" value="提交" />
  }
}
</text>)
    .Render();
}
@{Html.Telerik().Window().Modal(true).Visible(false)
    .Name("saving").Title("系统提示")
    .Buttons(buttons => buttons.Clear())
    .ClientEvents(window => window.OnOpen("OnSavingOpen"))
    .Content(
@<text>
正在保存，请稍后...
</text>)
    .Render();
}
@{Html.Telerik().Window().Modal(true).Visible(false)
    .Name("saveSuccess").Title("系统提示")
    .Buttons(buttons => buttons.Clear())
    .ClientEvents(window => window.OnOpen("OnSaveSuccessOpen"))
    .Content(
@<text>
保存成功！
</text>)
    .Render();
}
@{Html.Telerik().Window().Modal(true).Visible(false)
    .Name("saveError").Title("系统提示")
    .Buttons(buttons => buttons.Close())
    .ClientEvents(window => window.OnOpen("OnSaveErrorOpen").OnClose("OnSaveErrorClose"))
    .Content(
@<text>
出现错误，请重试！
</text>)
    .Render();
}
<script type="text/javascript">
    $(".t-item").live('click', function () {
        if ($(this).html() == "直肠") {
            $("#distance").css("visibility", "visible");
        } else {
            $("#distance").css("visibility", "hidden");
        }
    });

    function OnSavingOpen() {
        $("#saving").data("tWindow").center();
    }
    function OnSaveSuccessOpen() {
        $("#saveSuccess").data("tWindow").center();
    }
    function OnSaveErrorOpen() {
        $("#saveError").data("tWindow").center();
    }
    function OnSaveErrorClose() {
        $("#Passcode").val("");
    }
    
    function BeforeSend() {
        $("#saving").data("tWindow").open();
    }
    function OnSuccess(data) {
        if (data.ID) {
            var url = "@(Url.Action<BasicInfoController>(c => c.BasicInfoDetail(Guid.Empty)))";
            url = url.replace("@Guid.Empty", data.ID);
            window.location = url;
        } else {
            OnError();
        }
    }
    function OnError() {
        $("#saveError").data("tWindow").open();
        $("#saving").data("tWindow").close();
    }
</script>